//
//  Movie.m
//  豆瓣YHY
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "Movie.h"

@implementation Movie
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"movieName"]) {
        self.movieNamep = value;
    }
    if ([key isEqualToString:@"pic_url"]) {
        self.pic_url = value;
    }
    if ([key isEqualToString:@"rating"]) {
        self.rating = value;
    }
    
}
//2.实现协议中的编码方法
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:self.movieNamep forKey:@"movieName"];
    [aCoder encodeObject:self.pic_url forKey:@"pic_url"];
    
}

//3.实现协议中解编码方法
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    self = [super init];
    if (self) {
        self.movieNamep = [aDecoder decodeObjectForKey:@"movieName"];
        self.pic_url = [aDecoder decodeObjectForKey:@"pic_url"];
    }
    return self;
}
























@end
